#include <disp_manager.h>
#include <encoding_manager.h>
#include <fonts_manager.h>
#include <draw.h>

#include <unistd.h>
#include <getopt.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>


// ./ebook [-s Size] [-f fontfile] [-h hzk] [-d display] <text_file>
int main(int argc, char **argv)
{   
    int ret;
    int opt;
    int fontsize = 20; // 不设置的话默认字体大小为20
    unsigned char *fontfile = NULL;
    unsigned char *hzk = NULL;
    unsigned char *display = NULL;

    // 解析命令行参数
    while ((opt = getopt(argc, argv, "s:f:h:d:")) != -1) {
        switch (opt) 
        {
            case 's':
                fontsize = atoi(optarg); 
                printf("Size: %d\n", fontsize);
                break;
            case 'f':
                fontfile = optarg;  
                printf("Font file: %s\n", fontfile);
                break;
            case 'h':
                hzk = optarg; 
                printf("HZK file: %s\n", hzk);
                break;
            case 'd':
                display = optarg; 
                printf("Display Device: %s\n", display);
                break;
			default:
			{
                printf("Usage: %s [-s Size] [-f fontfile] [-h hzk] [-d display] <text_file>\n", argv[0]);
                return -1;
                break;
			}
        }
    }


    RegisterAllDispOpr();
    RegisterAllEncodingOpr();
    RegisterAllFontOpr();

    

    

    return 0;
}